home *** CD-ROM | disk | FTP | other *** search
- #ifndef __glutint_h__
- #define __glutint_h__
-
- /* Copyright (c) Mark J. Kilgard, 1994. */
-
- /* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
- #include <timer.h>
-
- #include "gl.h"
- #include "agl.h"
-
- typedef int Bool;
-
- #define ADD_TIME(dest, src1, src2) { \
- dest = src1 + src2;\
- }
-
- #define TIMEDELTA(dest, src1, src2) { \
- dest = src1 - src2;\
- }
-
- #define IS_AFTER(t1, t2) ((t2) > (t1))
- #define IS_AT_OR_AFTER(t1, t2) ((t2) >= (t1))
-
- /* Windows: */
- #define kMainWindow 128
- #define kPlainWindow 129
- /* Dilogs: */
- #define kAboutDialog 128
- /* Menus: */
- #define rMenuBar 128
- /* Apple menu: */
- #define mApple 128
- #define iAbout 1
- /* File menu: */
- #define mFile 129
- #define iQuit 1
- /* Edit menu: */
- #define mEdit 130
- #define iUndo 1
- #define iCut 3
- #define iCopy 4
- #define iPaste 5
- #define iClear 6
- /* Mouse menu items */
- #define mMouseMenuStart 131
-
-
- #define CWX 0x0001
- #define CWY 0x0002
- #define CWWidth 0x0004
- #define CWHeight 0x0008
-
- #define GLUT_WIND_IS_RGB(x) (((x) & GLUT_INDEX) == 0)
- #define GLUT_WIND_IS_INDEX(x) (((x) & GLUT_INDEX) != 0)
- #define GLUT_WIND_IS_SINGLE(x) (((x) & GLUT_DOUBLE) == 0)
- #define GLUT_WIND_IS_DOUBLE(x) (((x) & GLUT_DOUBLE) != 0)
- #define GLUT_WIND_HAS_ACCUM(x) (((x) & GLUT_ACCUM) != 0)
- #define GLUT_WIND_HAS_ALPHA(x) (((x) & GLUT_ALPHA) != 0)
- #define GLUT_WIND_HAS_DEPTH(x) (((x) & GLUT_DEPTH) != 0)
- #define GLUT_WIND_HAS_STENCIL(x) (((x) & GLUT_STENCIL) != 0)
- #define GLUT_WIND_IS_MULTISAMPLE(x) (((x) & GLUT_MULTISAMPLE) != 0)
- #define GLUT_WIND_IS_STEREO(x) (((x) & GLUT_STEREO) != 0)
- #define GLUT_WIND_IS_LUMINANCE(x) (((x) & GLUT_LUMINANCE) != 0)
- #define GLUT_WIND_IS_FULLSCREEN(x) (((x) & GLUT_FULLSCREEN) != 0)
-
- #define GLUT_NO_WORK 0x00
- #define GLUT_REDISPLAY_WORK 0x01
- #define GLUT_COLORMAP_WORK 0x02
- #define GLUT_FINISH_WORK 0x04
- #define GLUT_DEBUG_WORK 0x08
- #define GLUT_BUTTON_WORK 0x10
- #define GLUT_PASSIVE_WORK 0x20
- #define GLUT_ENTRY_WORK 0x40
-
- /* GLUT callback function types */
- typedef void (*GLUTdisplayCB) (void);
- typedef void (*GLUTreshapeCB) (int, int);
- typedef void (*GLUTkeyboardCB) (unsigned char, int, int);
- typedef void (*GLUTmouseCB) (int, int, int, int);
- typedef void (*GLUTmotionCB) (int, int);
- typedef void (*GLUTpassiveCB) (int, int);
- typedef void (*GLUTentryCB) (int);
- typedef void (*GLUTwindowStatusCB) (int);
- typedef void (*GLUTvisibilityCB) (int);
- typedef void (*GLUTidleCB) (void);
- typedef void (*GLUTtimerCB) (int);
- typedef void (*GLUTmenuStateCB) (int); /* DEPRICATED. */
- typedef void (*GLUTmenuStatusCB) (int, int, int);
- typedef void (*GLUTselectCB) (int);
- typedef void (*GLUTspecialCB) (int, int, int);
- typedef void (*GLUTspaceMotionCB) (int, int, int);
- typedef void (*GLUTspaceRotateCB) (int, int, int);
- typedef void (*GLUTspaceButtonCB) (int, int);
- typedef void (*GLUTdialsCB) (int, int);
- typedef void (*GLUTbuttonBoxCB) (int, int);
- typedef void (*GLUTtabletMotionCB) (int, int);
- typedef void (*GLUTtabletButtonCB) (int, int, int, int);
- #ifdef SUPPORT_FORTRAN
- typedef void (*GLUTdisplayFCB) (void);
- typedef void (*GLUTreshapeFCB) (int *, int *);
- /* NOTE the pressed key is int, not unsigned char for Fortran! */
- typedef void (*GLUTkeyboardFCB) (int *, int *, int *);
- typedef void (*GLUTmouseFCB) (int *, int *, int *, int *);
- typedef void (*GLUTmotionFCB) (int *, int *);
- typedef void (*GLUTpassiveFCB) (int *, int *);
- typedef void (*GLUTentryFCB) (int *);
- typedef void (*GLUTvisibilityFCB) (int *);
- typedef void (*GLUTidleFCB) (void);
- typedef void (*GLUTtimerFCB) (int *);
- typedef void (*GLUTmenuStateFCB) (int *); /* DEPRICATED. */
- typedef void (*GLUTmenuStatusFCB) (int *, int *, int *);
- typedef void (*GLUTselectFCB) (int *);
- typedef void (*GLUTspecialFCB) (int *, int *, int *);
- typedef void (*GLUTspaceMotionFCB) (int *, int *, int *);
- typedef void (*GLUTspaceRotateFCB) (int *, int *, int *);
- typedef void (*GLUTspaceButtonFCB) (int *, int *);
- typedef void (*GLUTdialsFCB) (int *, int *);
- typedef void (*GLUTbuttonBoxFCB) (int *, int *);
- typedef void (*GLUTtabletMotionFCB) (int *, int *);
- typedef void (*GLUTtabletButtonFCB) (int *, int *, int *, int *);
- #endif
-
- typedef struct _GLUTcolorcell GLUTcolorcell;
- struct _GLUTcolorcell {
- /* GLUT_RED, GLUT_GREEN, GLUT_BLUE */
- GLfloat component[3];
- };
-
- typedef struct _GLUTcolormap GLUTcolormap;
- struct _GLUTcolormap {
- CSpecArray cmap; /* Macintosh colormap ID */
- int refcnt; /* number of windows using colormap */
- int size; /* number of cells in colormap */
- int transparent; /* transparent pixel, or -1 if opaque */
- GLUTcolorcell *cells; /* array of cells */
- GLUTcolormap *next; /* next colormap in list */
- };
-
- typedef struct _GLUTwindow GLUTwindow;
-
- struct _GLUTwindow {
- int num; /* small integer window id (0-based) */
- /* CWindowPtr system related state. */
- CWindowPtr win; /* X window for GLUT window */
- AGLContext ctx; /* OpenGL context GLUT glut window */
- AGLPixelFormat vis; /* visual for window */
- char title[100];
-
- CSpecArray cmap; /* RGB colormap for window; None if CI */
- GLUTcolormap *colormap; /* colormap; NULL if RGBA */
-
- CWindowPtr renderWin; /* AGL window for rendering (might be
- overlay) */
- AGLContext renderCtx; /* OpenGL context for rendering (might
- be overlay) */
-
- GLboolean fullscreen;
- /* GLUT settable or visible window state. */
- int width; /* window width in pixels */
- int height; /* window height in pixels */
- int cursor; /* cursor name */
-
- #define MAX_MENUS 3
- int menus[MAX_MENUS];
-
- /* CWindowPtr relationship state. */
- GLUTwindow *parent; /* parent window */
- GLUTwindow *children; /* list of children */
- GLUTwindow *siblings; /* list of siblings */
- /* Misc. non-API visible (hidden) state. */
- Bool treatAsSingle; /* treat this window as single-buffered
- (it might be "fake" though) */
- Bool forceReshape; /* force reshape before display */
-
- int button_press;
-
- /* Work list related state. */
- unsigned int workMask; /* mask of window work to be done */
- GLUTwindow *prevWorkWin; /* link list of windows to work on */
-
- /* Callbacks */
- GLUTdisplayCB display; /* redraw callback */
- GLUTreshapeCB reshape; /* resize callback (width,height) */
- GLUTvisibilityCB visibility;
- GLUTmouseCB mouse; /* mouse callback (button,state,x,y) */
- GLUTmotionCB motion; /* motion callback (x,y) */
- GLUTpassiveCB passive; /* passive motion callback (x,y) */
- GLUTkeyboardCB keyboard; /* keyboard callback (ASCII,x,y) */
- GLUTspecialCB special; /* special key callback */
- GLUTentryCB entry; /* entry callback */
- GLUTmenuStateCB menu_state;
- GLUTmenuStatusCB menu_status;
- GLUTwindowStatusCB window_status;
- unsigned int entry_mode; /* last entry mode */
- #ifdef SUPPORT_FORTRAN
- /* Special Fortran display callback unneeded since no
- parameters! */
- GLUTreshapeFCB freshape; /* Fortran reshape callback */
- GLUTmouseFCB fmouse; /* Fortran mouse callback */
- GLUTmotionFCB fmotion; /* Fortran motion callback */
- GLUTpassiveFCB fpassive; /* Fortran passive callback */
- GLUTkeyboardFCB fkeyboard; /* Fortran keyboard callback */
- GLUTspecialFCB fspecial; /* special key callback */
- #endif
- };
-
- typedef struct _GLUTtimer GLUTtimer;
- struct _GLUTtimer {
- GLUTtimer *next; /* list of timers */
- double timeout; /* time to be called */
- GLUTtimerCB func; /* timer callback (value) */
- int value; /* callback return value */
- #ifdef SUPPORT_FORTRAN
- GLUTtimerFCB ffunc; /* Fortran timer callback */
- #endif
- };
-
- /* Frame buffer capability macros and types. */
- #define BUFFER_SIZE 0
- #define RGBA 1
- #define DOUBLEBUFFER 2
- #define STEREO 3
- #define AUX_BUFFERS 4
- #define RED_SIZE 5 /* Used as mask bit for
- "color selected". */
- #define GREEN_SIZE 6
- #define BLUE_SIZE 7
- #define ALPHA_SIZE 8
- #define DEPTH_SIZE 9
- #define STENCIL_SIZE 10
- #define ACCUM_RED_SIZE 11 /* Used as mask bit for
- "acc selected". */
- #define ACCUM_GREEN_SIZE 12
- #define ACCUM_BLUE_SIZE 13
- #define ACCUM_ALPHA_SIZE 14
- #define LEVEL 15
-
- #define CONFORMANT 16
- #define SAMPLES 17
- #define SLOW 18
-
- #define FULLSCREEN 19
-
- #define NUM_CAPS (FULLSCREEN + 1)
-
- /* Frame buffer capablities that don't have a corresponding
- FrameBufferMode entry. These get used as mask bits. */
- #define NUM NUM_CAPS + 0
- #define RGBA_MODE NUM_CAPS + 1
- #define CI_MODE NUM_CAPS + 2
-
- #define NONE 0
- #define EQ 1
- #define NEQ 2
- #define LTE 3
- #define GTE 4
- #define GT 5
- #define LT 6
- #define MIN 7
-
- typedef struct _Criterion {
- int capability;
- int comparison;
- int value;
- } Criterion;
-
- /* private variables from glut_event.c */
- extern GLUTwindow *__glutWindowWorkList;
- extern int __glutWindowDamaged;
- extern GLUTtimer *freeTimerList;
- #ifdef SUPPORT_FORTRAN
- extern GLUTtimer *__glutTimerList;
- extern GLUTtimer *__glutNewTimer;
- #endif
-
- /* private variables from glut_init.c */
- extern unsigned int __glutDisplayMode;
- extern char *__glutDisplayString;
- extern GLboolean __glutDebug;
- extern char **__glutArgv;
- extern char *__glutProgramName;
- extern int __glutArgc;
- extern int __glutInitHeight;
- extern int __glutInitWidth;
- extern int __glutInitX;
- extern int __glutInitY;
- extern unsigned int __glutModifierMask;
-
- /* private variables from glut_menu.c */
- extern void (*__glutMenuStatusFunc) (int, int, int);
- extern void __glutMenuKeyCommand(void);
- extern void __glutBuildMenuBar(void);
- extern void __glutMenuCommand(short menuNum, short itemNum);
-
- /* private variables from glut_win.c */
- extern GLUTwindow **__glutWindowList;
- extern GLUTwindow *__glutCurrentWindow;
- extern int __glutWindowListSize;
- extern void __glutWindowReshape(GLUTwindow *gwindow, int width,int height);
-
- /* private routines from glut_cindex.c */
- extern GLUTcolormap *__glutAssociateColormap(AGLPixelFormat vis);
- extern void __glutFreeColormap(GLUTcolormap *);
-
- /* private routines from glut_init.c */
- extern void __glutInitTime(double *beginning);
- extern double __glutTime(void);
-
- /* private routines from glut_util.c */
- extern void __glutWarning(const char *format,...);
- extern void __glutFatalError(const char *format,...);
- extern void __glutFatalUsage(const char *format,...);
-
- /* private routines from glut_win.c */
- extern GLUTwindow *__glutGetWindow(CWindowPtr win);
- extern void __glutRemoveFromWorkList(GLUTwindow *window);
- extern void __glutEstablishColormapsProperty(
- GLUTwindow * window);
- extern AGLPixelFormat __glutDetermineVisual(
- unsigned int mode,
- Bool * fakeSingle,
- AGLPixelFormat (getVisualInfo) (unsigned int));
- extern AGLPixelFormat __glutGetVisualInfo(unsigned int mode);
- extern int __glutSetCurrentWindow(GLUTwindow * window);
- extern void __glutDefaultReshape(int, int);
-
- extern GLboolean __glutPointInWindow(GLUTwindow *window, Point *point);
- extern void __glutCToStr255(const char *cs, Str255 ps);
-
- extern void __glutSetupColormap(
- AGLPixelFormat vi,
- GLUTcolormap ** colormap,
- CSpecArray * cmap);
-
- extern void __glutRebuildMenuBar(void);
- extern int __glutGetCurNumMenuItems(void);
-
- extern void __glutDefaultDisplay(void);
- extern void __glutCToPStr(const char *cs, Str255 ps);
-
- extern void __glutInitApp(void);
-
- extern GLUTwindow *__glutCreateWindow(GLUTwindow * parent, const char *title, int x, int y, int width, int height, int win_type);
- extern void __glutDestroyWindow(GLUTwindow * window, GLUTwindow * initialWindow);
-
- /* private routines from glut_ext.c */
- extern int __glutIsSupportedByAGL(const char *);
-
- extern void __glutPutOnWorkList(GLUTwindow * window, int workMask);
-
- extern char * __glutStrdup(const char *string);
- extern AGLPixelFormat __glutVisualInfoFromString(char *string);
-
- #endif /* __glutint_h__ */
-